<?php

use think\migration\Migrator;


class AlterPageSetting extends Migrator
{
    public function up()
    {
        $sql = <<<SQL
CREATE TABLE `page_setting` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
  `agent_id` int(11) NOT NULL DEFAULT '0' COMMENT '代理商id',
  `setting_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '名称',
  `image` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '图片',
  `sort` int(255) NOT NULL DEFAULT '0' COMMENT '排序desc',
  `status` tinyint(3) NOT NULL DEFAULT '1' COMMENT '状态：1启用 2禁用',
  `ext_data` json DEFAULT NULL COMMENT '扩展信息',
  `type` tinyint(3) NOT NULL DEFAULT '0' COMMENT '1.外卖2.聚合模板 3 品牌权益',
  `sub_category` tinyint(3) NOT NULL DEFAULT '0' COMMENT '子分类',
  `source` tinyint(3) NOT NULL DEFAULT '1' COMMENT '1系统2自定义',
  `position` tinyint(3) NOT NULL DEFAULT '0' COMMENT '首页轮播图位置 1头部 2中间',
  `created_at` timestamp NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
  `updated_at` timestamp NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  `deleted_at` datetime DEFAULT NULL COMMENT '删除时间，删除标识',
  PRIMARY KEY (`id`),
  KEY `idx_agent_id` (`agent_id`) USING BTREE,
  KEY `idx_agent_id_type_subCategory` (`agent_id`,`type`,`sub_category`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='订单记录表';  
SQL;
        $this->execute($sql);
    }

    public function down()
    {
        $this->dropTable('page_setting');

    }
}
